#ifndef MUSICWIDGET_H
#define MUSICWIDGET_H

#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <QMimeData>

namespace Ui {
class MusicWidget;
}

class MusicWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MusicWidget(QWidget *parent = 0);
    ~MusicWidget();
    void paintEvent(QPaintEvent *event);
    void initUI();
    void initMusicList();
    void initPlay();

private:
    Ui::MusicWidget *ui;
    QMediaPlayer *m_player;
    QMediaPlaylist *m_playlist;
    void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent *event);

private slots:

    void updatePos(qint64 pos);
    void updateDurTime(qint64 pos);
    void setPos(int pos);
    void updateInfo();
    void updatePlayBtn();
    void on_closeButton_clicked();
    void on_minButton_clicked();

    void on_listWidget_doubleClicked(const QModelIndex &index);
    void on_playButton_clicked();
    void on_playModeButton_clicked();
    void on_nextButton_clicked();
    void on_preButton_clicked();
    void on_volumeButton_clicked();
    void on_volumnSlider_valueChanged(int value);
    void on_musicAddButton_clicked();
    void on_deleteButton_clicked();
    void on_aboutButton_clicked();
    void on_pushButton_clicked();
};

#endif // MUSICWIDGET_H
